package com.jacky.ws.runners;

import com.corundumstudio.socketio.SocketIOServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class SocketServerRunner implements CommandLineRunner {

    private final Logger LOG = LoggerFactory.getLogger(SocketServerRunner.class);

    private SocketIOServer socketIOServer;

    public SocketServerRunner(SocketIOServer socketIOServer) {
        this.socketIOServer = socketIOServer;
    }

    @Override
    public void run(String... args) throws Exception {
        LOG.info("正在启动 socketIOServer ...");
        socketIOServer.start();
        LOG.info("socketIOServer 已启动");
    }
}
